package Tree.Recursive;

import Utils.TreeNode;

/**
 * 翻转二叉树
 * Lettcode 226: https://leetcode-cn.com/problems/invert-binary-tree/
 */
public class invertTree {
    public TreeNode invertTree(TreeNode root) {
        if (root == null) {
            return null;
        }
        TreeNode temp = root.left;
        root.left = invertTree(root.right);
        root.right = invertTree(temp);
        return root;
    }
}
